﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IBatisNet.DataMapper;
using Tasks.Common.Entitys;
using System.Collections;

namespace Tasks.Dao
{
    /// <summary><c>NoticeReadStateDao</c> is the implementation of <see cref="INoticeReadStateDao"/>.</summary>
    public partial class NoticeReadStateDao : Mapper
    {

        /// <summary>Implements <see cref="INoticeReadStateDao.GetCount"/></summary>
        public int GetCount()
        {
            String stmtId = "NoticeReadState.GetCount";
            int result = ExecuteQueryForObject<int>(stmtId, null);
            return result;
        }
        /// <summary>Implements <see cref="INoticeReadStateDao.GetNoticeReadStateByReaderID"/></summary>
        public int GetNoticeReadStateByReaderIDCount(int ReaderID, int OwnerID)
        {
            Hashtable ht = new Hashtable();
            ht["ReaderID"] = ReaderID;
            ht["OwnerID"] = OwnerID;
            String stmtId = "NoticeReadState.GetNoticeReadStateByReaderIDCount";
            int result = ExecuteQueryForObject<int>(stmtId, ht);
            return result;
        }

        public int GetUnReadByNoticeModeCount(int ReaderID, int NoticeMode, int OfficeID, int OwnerID)
        {
            Hashtable ht = new Hashtable();
            ht["ReaderID"] = ReaderID;
            ht["NoticeMode"] = NoticeMode;
            ht["OwnerID"] = OwnerID;
            ht["OfficeID"] = OfficeID;
            String stmtId = "NoticeReadState.GetUnReadByNoticeModeCount";
            int result = ExecuteQueryForObject<int>(stmtId, ht);
            return result;
        }

        public NoticeReadState FindTop1UnReadByNoticeMode(int ReaderID, int NoticeMode, int OfficeID, int OwnerID)
        {
            Hashtable ht = new Hashtable();
            ht["ReaderID"] = ReaderID;
            ht["NoticeMode"] = NoticeMode;
            ht["OwnerID"] = OwnerID;
            ht["OfficeID"] = OfficeID;
            String stmtId = "NoticeReadState.FindTop1UnReadByNoticeMode";
            NoticeReadState result = ExecuteQueryForObject<NoticeReadState>(stmtId, ht);
            return result;
        }

        /// <summary>Implements <see cref="INoticeReadStateDao.FindByReaderIDNoticeID"/></summary>
        public int FindByReaderIDNoticeID(Hashtable ht)
        {
            String stmtId = "NoticeReadState.FindByReaderIDNoticeID";
            int result = ExecuteQueryForObject<int>(stmtId, ht);
            return result;
        }
        /// <summary>Implements <see cref="INoticeReadStateDao.Find"/></summary>
        public NoticeReadState Find(Int32 readerID)
        {
            String stmtId = "NoticeReadState.Find";
            NoticeReadState result = ExecuteQueryForObject<NoticeReadState>(stmtId, readerID);
            return result;
        }
        public IList<NoticeReadState> FindByTourTeamPlan(Hashtable ht)
        {
            String stmtId = "NoticeReadState.FindUnReadByTourTeamPlan";
            IList<NoticeReadState> result = ExecuteQueryForList<NoticeReadState>(stmtId, ht);
            return result;
        }
        /// <summary>Implements <see cref="INoticeReadStateDao.FindByReaderIDNoticeID"/></summary>
        public int FindNoticeReaderCount(Int32 NoticeID, int ReaderID)
        {
            Hashtable ht = new Hashtable();
            ht["NoticeID"] = NoticeID;
            ht["ReaderID"] = ReaderID;
            String stmtId = "NoticeReadState.FindByReaderIDNoticeID";
            int result = ExecuteQueryForObject<int>(stmtId, ht);
            return result;
        }
        /// <summary>Implements <see cref="INoticeReadStateDao.FindAll"/></summary>
        public IList<NoticeReadState> FindAll()
        {
            String stmtId = "NoticeReadState.FindAll";
            IList<NoticeReadState> result = ExecuteQueryForList<NoticeReadState>(stmtId, null);
            return result;
        }

        /// <summary>Implements <see cref="INoticeReadStateDao.QuickFindAll"/></summary>
        public IList<NoticeReadState> QuickFindAll()
        {
            String stmtId = "NoticeReadState.QuickFindAll";
            IList<NoticeReadState> result = ExecuteQueryForList<NoticeReadState>(stmtId, null);
            return result;
        }

        /// <summary>Implements <see cref="INoticeReadStateDao.FindByNoticeID"/></summary>
        public IList<NoticeReadState> FindByNoticeID(Int32 noticeID)
        {
            String stmtId = "NoticeReadState.FindByNoticeID";
            IList<NoticeReadState> result = ExecuteQueryForList<NoticeReadState>(stmtId, noticeID);
            return result;
        }

        /// <summary>Implements <see cref="INoticeReadStateDao.FindByReaderState"/></summary>
        public IList<NoticeReadState> FindByReaderState(Int32? readerState)
        {
            String stmtId = "NoticeReadState.FindByReaderState";
            IList<NoticeReadState> result = ExecuteQueryForList<NoticeReadState>(stmtId, readerState);
            return result;
        }

        /// <summary>Implements <see cref="INoticeReadStateDao.Insert"/></summary>
        public void Insert(NoticeReadState obj)
        {
            if (obj == null) throw new ArgumentNullException("obj");
            String stmtId = "NoticeReadState.Insert";
            ExecuteInsert(stmtId, obj);
        }

        /// <summary>Implements <see cref="INoticeReadStateDao.Update"/></summary>
        public void Update(NoticeReadState obj)
        {
            if (obj == null) throw new ArgumentNullException("obj");
            String stmtId = "NoticeReadState.Update";
            ExecuteUpdate(stmtId, obj);
        }
        /// <summary>Implements <see cref="INoticeReadStateDao.Update"/></summary>
        public void UpdateALL(NoticeReadState obj)
        {
            if (obj == null) throw new ArgumentNullException("obj");
            String stmtId = "NoticeReadState.UpdateALL";
            ExecuteUpdate(stmtId, obj);
        }
        /// <summary>Implements <see cref="INoticeReadStateDao.Delete"/></summary>
        public void Delete(NoticeReadState obj)
        {
            if (obj == null) throw new ArgumentNullException("obj");
            String stmtId = "NoticeReadState.Delete";
            ExecuteDelete(stmtId, obj);
        }

        /// <summary>Implements <see cref="INoticeReadStateDao.DeleteByNoticeID"/></summary>
        public int DeleteByNoticeID(Int32 noticeID)
        {
            String stmtId = "NoticeReadState.DeleteByNoticeID";
            int result = ExecuteDelete(stmtId, noticeID);
            return result;
        }

        /// <summary>Implements <see cref="INoticeReadStateDao.DeleteByReaderState"/></summary>
        public int DeleteByReaderState(Int32? readerState)
        {
            String stmtId = "NoticeReadState.DeleteByReaderState";
            int result = ExecuteDelete(stmtId, readerState);
            return result;
        }

        /// <summary>Implements <see cref="INoticeReadStateDao.Reload"/></summary>
        public void Reload(NoticeReadState obj)
        {
            if (obj == null) throw new ArgumentNullException("obj");
            String stmtId = "NoticeReadState.Find";
            ExecuteQueryForObject<NoticeReadState>(stmtId, obj);
        }

    }
}
